The 'update( )' Function updates the current Set by getting the values from the other Set.
x = {"Mohan", "Kriti", "Salim"} y = {"Sia", "Andrew", "Kriti"} x.update(y) print(x)
So, in the above code we have created a 'Set' and initialised to the variable 'x'.
Then what we have done is, put the names, 'Sia', 'Andrew' and 'Kriti' in another set 'y'.
And used the 'update( )' Function to add the new Set 'y'(With values 'Sia', 'Andrew' and 'Kriti') to the existing Set 'x'.
And the new values, 'Sia' and 'Andrew' from Set 'y' gets added to the existing Set 'x'.
And since, 'Kriti' is present in both the Sets, 'Kriti' will be added once. Else it might cause a duplicate entry.
And we get the below output,